﻿#include "FITKPhyscisPropertyBeam.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppSettings.h"
#include <QColor>

namespace Acoustics
{
    FITKPhyscisPropertyBeam::FITKPhyscisPropertyBeam()
    {
        this->updateDefaultColor();
    }

    FITKPhyscisPropertyBeam::~FITKPhyscisPropertyBeam()
    {

    }

    FITKAcousticsAbsPhysicsProp::AcousticsPhyscisPropType FITKPhyscisPropertyBeam::getPhysicsPropType()
    {
        return AcousticsPhyscisPropType::APPBeam;
    }

    double FITKPhyscisPropertyBeam::getCrossSectionArea() const
    {
        return _crossSectionArea;
    }

    void FITKPhyscisPropertyBeam::setCrossSectionArea(double crossSectionArea)
    {
        _crossSectionArea = crossSectionArea;
    }

    double FITKPhyscisPropertyBeam::getPerimeter() const
    {
        return _perimeter;
    }

    void FITKPhyscisPropertyBeam::setPerimeter(double perimeter)
    {
        _perimeter = perimeter;
    }

    double FITKPhyscisPropertyBeam::getSecondMomentX() const
    {
        return _secondmomentX;
    }

    void FITKPhyscisPropertyBeam::setSecondMomentX(double secondmomentX)
    {
        _secondmomentX = secondmomentX;
    }

    double FITKPhyscisPropertyBeam::getSecondMomentY() const
    {
        return _secondmomentY;
    }

    void FITKPhyscisPropertyBeam::setSecondMomentY(double secondmomentY)
    {
        _secondmomentY = secondmomentY;
    }

    double FITKPhyscisPropertyBeam::getPolarMoment() const
    {
        return _polarMoment;
    }

    void FITKPhyscisPropertyBeam::setPolarMoment(double polarMoment)
    {
        _polarMoment = polarMoment;
    }

    double FITKPhyscisPropertyBeam::getTorsionalConstant() const
    {
        return _torsionalConstant;
    }

    void FITKPhyscisPropertyBeam::setTorsionalConstant(double torsionalConstant)
    {
        _torsionalConstant = torsionalConstant;
    }

    double FITKPhyscisPropertyBeam::getShearOffsetX() const
    {
        return _shearOffsetX;
    }

    void FITKPhyscisPropertyBeam::setShearOffsetX(double shearOffsetX)
    {
        _shearOffsetX = shearOffsetX;
    }

    double FITKPhyscisPropertyBeam::getShearOffsetY() const
    {
        return _shearOffsetY;
    }

    void FITKPhyscisPropertyBeam::setShearOffsetY(double sharOffsetY)
    {
        _shearOffsetY = sharOffsetY;
    }

    void FITKPhyscisPropertyBeam::updateDefaultColor()
    {
        //获取软件设置
        AppFrame::FITKAppSettings* settings = FITKAPP->getAppSettings();
        if (!settings) return;
        //获取配置
        QVariant beam = settings->getVarient("BeamPhyPropColor");
        //更新流体材料颜色
        if (beam.isNull())
        {
            beam = settings->getVarient("OriBeamPhyPropColor");
            if (beam.isNull()) return;
        }
        QColor beamColor = beam.value<QColor>();
        _color[0] = beamColor.redF();
        _color[1] = beamColor.greenF();
        _color[2] = beamColor.blueF();
    }
}
